<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('积分提现列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <!--<li>
                                <p>真实姓名：</p>
                                <input type="text" name="realName"/>
                            </li>-->
                            <li>
                                <p>银行卡号：</p>
                                <input type="text" name="cardNum"/>
                            </li>
                            <li>
                                <p>支付宝号：</p>
                                <input type="text" name="alipayNum"/>
                            </li>
                            <li>
                                <p>微信账号：</p>
                                <input type="text" name="wxNum"/>
                            </li>
                            <!--<li>
                                <p>提现金额：</p>
                                <input type="text" name="money"/>
                            </li>-->
                            <li>
                                <p>提现类型：</p>
                                <select name="type" th:with="type=${@dict.getType('cash_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>提现状态：</p>
                                <select name="status" th:with="type=${@dict.getType('cash_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:cash:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:cash:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:cash:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:cash:export">
                    <i class="fa fa-download"></i> 导出
                 </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:cash:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:cash:remove')}]];
        var typeDatas = [[${@dict.getType('cash_type')}]];
        var statusDatas = [[${@dict.getType('cash_status')}]];
        var prefix = ctx + "system/cash";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                sortName: "createTime",
                sortOrder: "desc",
                modalName: "积分提现",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : 'id',
                    visible: false
                },
                {
                    field : 'realName', 
                    title : '真实姓名'
                },
                {
                    field : 'bankName',
                    title : '开户银行'
                },
                {
                    field : 'cardNum', 
                    title : '银行卡号'
                },
                {
                    field : 'alipayNum', 
                    title : '支付宝账号'
                },
                {
                    field : 'wxNum', 
                    title : '微信账号'
                },
                {
                    field : 'money', 
                    title : '提现金额'
                },
                {
                    field : 'type', 
                    title : '提现类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(typeDatas, value);
                    }
                },
                {
                    field : 'status', 
                    title : '提现状态',
                    formatter: function(value, row, index) {
                        var str = $.table.selectDictLabel(statusDatas, value);
                        if(row.status==0){
                            return '<i style="color: red">'+str+'</i>';
                        }else{
                            return '<i style="color: green">'+str+'</i>';
                        }
                    }
                },
                {
                    field : 'memberName',
                    title : '业务员'
                },
                {
                    field : 'createTime',
                    title : '创建时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.status!=1){
                            actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="passStatus(\'' + row.id + '\')"><i class="fa fa-edit"></i>完成</a> ');
                        }
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        /* 完成状态 */
        function passStatus(id) {
            $.modal.confirm("确认完成提现吗？", function() {
                $.operate.post(prefix + "/passStatus", { "id": id, "status": 1 });
            })
        }
    </script>
</body>
</html>